<?php
/**
 * Created by PhpStorm.
 * User: Lenovo
 * Date: 2017/12/15
 * Time: 11:35
 */
namespace app\home\service;

use app\infrastructure\uri\Request;
use app\infrastructure\uri\Uri;
use think\Controller;

class Smstmp extends Controller{
    private $client;
    public  function  __construct(){
        parent::__construct();
        $this->client=new Request();
    }
      /**
       * 发送APP推送
       */
    public function sendApp($msg,$reciver){
        $url=Uri::HOST.Uri::SENDAPPSMS;
        $data=[
            'msg'=>$msg,
            'reciver'=>$reciver
        ];
        $res= $this->client->getArrayData($url,$data,3);
        return $res;
    }

    /**
     * 获取app推动的模板
     */
    public function getAppSmsTmp($plantForm){
        $url=Uri::HOST.Uri::SELECTSMSTMP."?plantForm=".$plantForm."&is_valid=1";
        $smsAppTmp=$this->client->getArrayData($url);
        if($smsAppTmp['code'] != 0){
            $smsAppTmp=[];
        }else{
            $smsAppTmp=$smsAppTmp['data'];
        }
        return $smsAppTmp;
    }
}